package sk.project.accounting.data.model;

// Generated Dec 17, 2012 9:50:06 PM by Hibernate Tools 3.4.0.CR1

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Commodity generated by hbm2java
 */
@Entity
@Table(name = "commodity", catalog = "skl_hosp_new")
public class Commodity implements java.io.Serializable {

	private Integer id;
	private CommodityType commodityType;
	private UnitOfMeasure unitOfMeasure;
	private String name;
	private Date updated;
	private String plu;
	private float vat;
	private Set<WarehouseCommodity> warehouseCommodities = new HashSet<WarehouseCommodity>(
			0);
	private Set<PriceHistory> priceHistories = new HashSet<PriceHistory>(0);
	private Set<IssueCard> issueCards = new HashSet<IssueCard>(0);

	public Commodity() {
	}

	public Commodity(UnitOfMeasure unitOfMeasure, String plu, float vat) {
		this.unitOfMeasure = unitOfMeasure;
		this.plu = plu;
		this.vat = vat;
	}

	public Commodity(CommodityType commodityType, UnitOfMeasure unitOfMeasure,
			String name, Date updated, String plu, float vat,
			Set<WarehouseCommodity> warehouseCommodities,
			Set<PriceHistory> priceHistories, Set<IssueCard> issueCards) {
		this.commodityType = commodityType;
		this.unitOfMeasure = unitOfMeasure;
		this.name = name;
		this.updated = updated;
		this.plu = plu;
		this.vat = vat;
		this.warehouseCommodities = warehouseCommodities;
		this.priceHistories = priceHistories;
		this.issueCards = issueCards;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "id_commodity_type")
	public CommodityType getCommodityType() {
		return this.commodityType;
	}

	public void setCommodityType(CommodityType commodityType) {
		this.commodityType = commodityType;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "id_unit_of_measure", nullable = false)
	public UnitOfMeasure getUnitOfMeasure() {
		return this.unitOfMeasure;
	}

	public void setUnitOfMeasure(UnitOfMeasure unitOfMeasure) {
		this.unitOfMeasure = unitOfMeasure;
	}

	@Column(name = "name", length = 500)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "updated", length = 19)
	public Date getUpdated() {
		return this.updated;
	}

	public void setUpdated(Date updated) {
		this.updated = updated;
	}

	@Column(name = "plu", nullable = false, length = 100)
	public String getPlu() {
		return this.plu;
	}

	public void setPlu(String plu) {
		this.plu = plu;
	}

	@Column(name = "vat", nullable = false, precision = 12, scale = 0)
	public float getVat() {
		return this.vat;
	}

	public void setVat(float vat) {
		this.vat = vat;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "commodity")
	public Set<WarehouseCommodity> getWarehouseCommodities() {
		return this.warehouseCommodities;
	}

	public void setWarehouseCommodities(
			Set<WarehouseCommodity> warehouseCommodities) {
		this.warehouseCommodities = warehouseCommodities;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "commodity")
	public Set<PriceHistory> getPriceHistories() {
		return this.priceHistories;
	}

	public void setPriceHistories(Set<PriceHistory> priceHistories) {
		this.priceHistories = priceHistories;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "commodity")
	public Set<IssueCard> getIssueCards() {
		return this.issueCards;
	}

	public void setIssueCards(Set<IssueCard> issueCards) {
		this.issueCards = issueCards;
	}

}
